/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author edgar
 */
@Entity
@Table(name = "articulos")
@NamedQueries({
    @NamedQuery(name = "Articulos.findAll", query = "SELECT a FROM Articulos a"),
    @NamedQuery(name = "Articulos.findByCodArticulo", query = "SELECT a FROM Articulos a WHERE a.codArticulo = :codArticulo"),
    @NamedQuery(name = "Articulos.findByDescripcion", query = "SELECT a FROM Articulos a WHERE a.descripcion = :descripcion"),
    @NamedQuery(name = "Articulos.findByPrecio", query = "SELECT a FROM Articulos a WHERE a.precio = :precio")})
public class Articulos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod_articulo")
    private Integer codArticulo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "descripcion")
    private String descripcion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "precio")
    private Float precio;
    @JoinColumn(name = "cod_familia", referencedColumnName = "cod_familia")
    @ManyToOne
    private FamiliaArticulos codFamilia;
    @OneToMany(mappedBy = "codArticulo")
    private Collection<NotasCreditoDetalle> notasCreditoDetalleCollection;
    @OneToMany(mappedBy = "codArticulo")
    private Collection<VentasDetalle> ventasDetalleCollection;
    @OneToMany(mappedBy = "codArticulo")
    private Collection<EntradaSalidaArticulos> entradaSalidaArticulosCollection;
    @OneToMany(mappedBy = "codArticulo")
    private Collection<ComprasDetalle> comprasDetalleCollection;

    public Articulos() {
    }

    public Articulos(Integer codArticulo) {
        this.codArticulo = codArticulo;
    }

    public Articulos(Integer codArticulo, String descripcion) {
        this.codArticulo = codArticulo;
        this.descripcion = descripcion;
    }

    public Integer getCodArticulo() {
        return codArticulo;
    }

    public void setCodArticulo(Integer codArticulo) {
        this.codArticulo = codArticulo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Float getPrecio() {
        return precio;
    }

    public void setPrecio(Float precio) {
        this.precio = precio;
    }

    public FamiliaArticulos getCodFamilia() {
        return codFamilia;
    }

    public void setCodFamilia(FamiliaArticulos codFamilia) {
        this.codFamilia = codFamilia;
    }

    public Collection<NotasCreditoDetalle> getNotasCreditoDetalleCollection() {
        return notasCreditoDetalleCollection;
    }

    public void setNotasCreditoDetalleCollection(Collection<NotasCreditoDetalle> notasCreditoDetalleCollection) {
        this.notasCreditoDetalleCollection = notasCreditoDetalleCollection;
    }

    public Collection<VentasDetalle> getVentasDetalleCollection() {
        return ventasDetalleCollection;
    }

    public void setVentasDetalleCollection(Collection<VentasDetalle> ventasDetalleCollection) {
        this.ventasDetalleCollection = ventasDetalleCollection;
    }

    public Collection<EntradaSalidaArticulos> getEntradaSalidaArticulosCollection() {
        return entradaSalidaArticulosCollection;
    }

    public void setEntradaSalidaArticulosCollection(Collection<EntradaSalidaArticulos> entradaSalidaArticulosCollection) {
        this.entradaSalidaArticulosCollection = entradaSalidaArticulosCollection;
    }

    public Collection<ComprasDetalle> getComprasDetalleCollection() {
        return comprasDetalleCollection;
    }

    public void setComprasDetalleCollection(Collection<ComprasDetalle> comprasDetalleCollection) {
        this.comprasDetalleCollection = comprasDetalleCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codArticulo != null ? codArticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articulos)) {
            return false;
        }
        Articulos other = (Articulos) object;
        if ((this.codArticulo == null && other.codArticulo != null) || (this.codArticulo != null && !this.codArticulo.equals(other.codArticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Articulos[ codArticulo=" + codArticulo + " ]";
    }
    
}
